exports.asyncHandler = (hander)=>{
    return async (req,res,next)=>{
        try{

            const result = await hander(req,res,next);
            res.send(exports.getResult(result));
        }catch(err){
            next(err);
        }
    }

}
exports.getResult = (result)=>{
    return{
        code:0,
        msg:'',
        data:result
    }
}
exports.getErr = (err="服务器内部出错",errCode = 500)=>{
    return{
        code:errCode,
        msg:err
    }
}